package com.piggy.logi.sys.controller;

import com.piggy.common.core.domain.R;
import com.piggy.common.core.web.controller.BaseController;
import com.piggy.common.satoken.utils.SecurityUtils;
import com.piggy.logi.sys.service.ILogiIndexStatisticsService;
import com.piggy.logi.sys.vo.LogiIndexStatisticsVo;
import com.piggy.logi.sys.vo.LogiPlatIndexStatisticsVo;
import com.piggy.logi.sys.vo.LogiPlatTodoMattersVo;
import com.piggy.logi.sys.vo.LogiTodoMattersVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页统计Controller
 *
 * @author fengxy
 * @date 2023/10/17 21:28
 **/
@Api(value = "首页统计控制器", tags = {"首页统计"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/sys/index")
public class LogiIndexStatisticsController extends BaseController {

    private final ILogiIndexStatisticsService iLogiIndexStatisticsService;

    /**
     * 统计数据（物流系统）
     */
    @ApiOperation("统计数据（物流系统）")
    //@SaCheckPermission("sys:index:statistics")
    @PostMapping("/statistics")
    public R<LogiIndexStatisticsVo> statistics() {
        LogiIndexStatisticsVo indexStatisticsVo = iLogiIndexStatisticsService.indexStatistics(SecurityUtils.getMainDeptId());
        return R.ok(indexStatisticsVo);
    }

    /**
     * 待办事项（物流系统）
     */
    @ApiOperation("待办事项（物流系统）")
    //@SaCheckPermission("sys:index:todo")
    @PostMapping("/todo")
    public R<LogiTodoMattersVo> todo() {
        LogiTodoMattersVo todoMattersVo = iLogiIndexStatisticsService.todoMatters(SecurityUtils.getMainDeptId());
        return R.ok(todoMattersVo);
    }

    /**
     * 统计数据（平台系统）
     */
    @ApiOperation("统计数据（平台系统）")
    //@SaCheckPermission("sys:index:plat:statistics")
    @PostMapping("/plat/statistics")
    public R<LogiPlatIndexStatisticsVo> platStatistics() {
        LogiPlatIndexStatisticsVo platIndexStatisticsVo = iLogiIndexStatisticsService.platIndexStatistics();
        return R.ok(platIndexStatisticsVo);
    }

    /**
     * 待办事项（平台系统）
     */
    @ApiOperation("待办事项（平台系统）")
    //@SaCheckPermission("sys:index:plat:todo")
    @PostMapping("/plat/todo")
    public R<LogiPlatTodoMattersVo> platTodo() {
        LogiPlatTodoMattersVo platTodoMattersVo = iLogiIndexStatisticsService.platTodoMatters();
        return R.ok(platTodoMattersVo);
    }
}
